import services from '../../services/api';
const initialState = {};
export default {
  name: 'code',
  state: initialState,
  reducers: {
    updateCodes: (state, { data }) => {
      return {
        ...state,
        ...data,
      };
    },
  },
  effects: {
    queryConfigCode: async ({ params }, { dispatch }) => {
      services.common.getCodeConfig({}).then((res) => {
        if (res.code === '0') {
          dispatch({ type: 'code/updateCodes', data: res.data });
        }
      });
    },
  },
};
